<?php 
class Category{
	protected $db;
	protected $tab;
	public function __construct($db,$tab='goods_category'){
		$this->db =$db;
		$this->tab =$tab;
	}
	public function getAllCategory(){
		$sql ="select id,name from {$this->tab} where pid=0";
		return $this->db->selectRows($sql);
	}
	public function getCategory(){
		$id=$_GET['id'];
		$sql ="select * from {$this->tab} where pid={$id}";
		return $this->db->selectRows($sql);
	}	
}
	
 ?>